package com.yuneec.droneservice.command;

import com.yuneec.droneservice.request.IResponse;

/**
 *
 * Created by gjw on 2017/3/27.
 */

public class Calibrate extends BaseCommand {

    private Calibrate(byte op) {
        super(MAV_RC_COMMAND.MAV_RC_CMD_CALIBRATE);
        data = new byte[1];
        data[0] = op;
    }

    public static Calibrate startCalibrateCmd() {
        byte op = 0x01;
        return new Calibrate(op);
    }

    public static Calibrate stopCalibrateCmd() {
        byte op = 0x00;
        return new Calibrate(op);
    }

    public static Calibrate cancelCalibrateCmd() {
        byte op = 0x02;
        return new Calibrate(op);
    }

    @Override
    public IResponse toResponse(byte[] data, int off, int len) {
        int code = data[off + 1] & 0xff;
        return new IResponse(ids(), code);
    }
}
